<template>
  <div class="edit">
    <iframe class="webview" :src="url" frameborder="0"></iframe>
  </div>
</template>

<script>
export default {
  name: "edit",
  data() {
    return {
      baseUrl: "http://web.zhgylgl.com/screen/#/configure",
      // baseUrl: "http://localhost:8081/#/configure",
      type: ""
    };
  },
  mounted() {
    let query = this.$route.query;
    this.type = query.type;
    this.initial();
  },
  computed: {
    url() {
      if (this.type && this.type != "") {
        return this.baseUrl + "?type=" + this.type;
      } else {
        return this.baseUrl;
      }
    }
  },
  methods: {
    async initial() {
      window.addEventListener("message", event => {
        // console.log("我收到消息啦", event.data);
        if (event.data == 'toList') {
          this.$router.push("/pageConfig/list");
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.edit {
  width: 100%;
  height: 100%;
  background: #fff;

  .webview {
    width: 100%;
    height: 100%;
  }
}
</style>
